package threading;

public class ThreadDemo13 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread( () -> {
            while (true) {
                System.out.println("hello t");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        t.start();;


        t.join(3000);//在t线程执行的时候，如果t线程没有执行结束，main线程就会阻塞等待
        System.out.println("hello main");
    }
}
